<% var pageLevelJS = { %>
<script type="text/javascript">
var settings = {
		 modelDomainFlag:"sys"
		,modelFlag:"file"
		,key:"${sessionId}"
		,addDivId:'add-dialog'
		 ,toAddUrl:window.global.ctx+"/sys/file/toadd"
		 ,toUpdateUrl:window.global.ctx+"/sys/file/toupdate"
	 	,canDelete:${shiro.hasPermission('sys_file:delete:*')}
	 	,canRemove:${shiro.hasPermission('sys_file:remove:*')}
		,canUpdate:false
		,canAdd:${shiro.hasPermission('sys_file:add:*')}
		,canDetail:${shiro.hasPermission('sys_file:detail:*')}
		}
window.global.hasInstance = ${sysFlags.~size>1};
</script> 
<script type="text/javascript" src="${ctx}/static/js/sys/file/index.js"></script>
<%};%> 
<% var form = { %>
			<form id="searchForm" action="${ctx}/sys/file/query?_style=bs&${session._para}" class="form-inline" role="form">
				  <input type="hidden"  name="pId" value="${data.id}">
				  <input type="hidden"  name="_parents" value="${data.parents}/${data.name}">
				  <%if(has(sysFlags) && sysFlags.~size>1){ %>
					   <div class="form-group  ">
					     <label for="categoryCode">所属系统:</label>
						 <select placeholder="类别" name="instanceId" >
						    <option value="">--系统--</option>
							<% for(res in sysFlags!){ %>
							  <option value="${res.id}" >${res.nameStr}</option>
						　　   <% } %>
						</select>
					  </div>
				   <%}else{%>
				       <input type="hidden"  name="instanceId" value="">
				    <% } %>
				  <div class="form-group">
				     <label for="name">文件名:</label>
				     <input type="text" class="validate[maxSize[50]] " name="name" placeholder="文件名">
				  </div>
				    <div class="form-group hide">
				     <label for="name">编号:</label>
				     <input type="text" class="validate[maxSize[50]] " name="num" placeholder="编号">
				  </div>
				  <div class="form-group">
				     <label for="startDate">创建日期:</label>
				     <input  style="height:32px;" class="Wdate" type="text" name="createDtSt" id="startDate" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'endDate\')}'})"    placeholder="请输入开始日期"/>
				     <label for="endDate">至</label>
				     <input  style="height:32px;" class="Wdate" type="text" name="createDtEd" id="endDate" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'startDate\')}'})"    placeholder="请输入结束日期"/>
				  </div>
				  <div class="form-group" >
				       <label for="validClass">有效区分:</label>
				 	   <div class="form-control" id="validClass"> 
					       <label class="">
					         <input type="radio" name="validClass" class="toggle" value="1">有效
					       </label>
					       <label class="">
					         <input type="radio" name="validClass" class="toggle" value="0">无效
					       </label>
					       <label class="">
					         <input type="radio" name="validClass" checked="checked" class="toggle" value="">全部
					       </label>
				       </div>
				</div>
				  <div class="form-group"  >
				       <label for="validClass">删除区分:</label>
				 	   <div class="form-control" id="deleteClass"> 
					       <label class="">
					         <input type="radio" name="deleteClass" class="toggle" value="1">已删除
					       </label>
					       <label class="">
					         <input type="radio" name="deleteClass" class="toggle" value="0">未删除
					       </label>
					       <label class="">
					         <input type="radio" name="deleteClass" checked="checked" class="toggle" value="">全部
					       </label>
				       </div>
				</div>
				
			</form>
<%};%> 

<% var toolbar = { %>
<%if(shiro.hasPermission('sys_file:add:*')) {%>
				<button type="button" class="btn btn-primary btn-xs addBtn" title="新增" data-toggle="modal" data-target="#myModal">
					<i class="ace-icon fa  fa-plus bigger-120"></i>新增目录
				</button> 
				<%}%>
				<%if(shiro.hasPermission('sys_file:add:*')) {%>
				<button type="button" url="${ctx}/sys/file/toupload" class="btn btn-info btn-xs importBtn" title="上传文件">
			<i class="ace-icon fa fa-upload bigger-120"></i>上传文件
		</button> 
				<%}%>
				<%if(shiro.hasPermission('sys_file:remove:*')||shiro.hasPermission('sys_file:update:*')) {%>
				<button type="button" class="btn btn-warning btn-xs removeBtn" title="将数据标识为删除状态">
					<i class="ace-icon fa fa-trash-o bigger-120"></i>逻辑删除
				</button> 
				<%}%>
				<%if(shiro.hasPermission('sys_file:delete:*')) {%>
				<button type="button" class="btn btn-danger btn-xs delBtn" title="物理删除数据">
					<i class="ace-icon fa fa-trash-o bigger-120"></i>删除
				</button> 
				<%}%>
				<div class="pull-right">
 			    <button type="button" class="btn btn-info btn-xs tableBtn" title="控制非核心列">
				<i class="ace-icon fa bigger-120">隐藏</i>
			</button>
		</div>
<%};%> 

<% var ths = { %>
      				<th w_render="checkboxFunc" width="50px" w_class="center hidden-480"  w_index="id" width="50px"><input type="checkbox"/></th>
	                <th w_num="total_line" w_class="hidden-480" width="50px">序号</th>
			        <th w_index="name" w_render="nameFunc"  w_tip="true" >文件名</th>
			        <th w_index="sizeStr" w_class="hidden-480" w_tip="true" >文件大小</th>
			        <th w_index="suffix" w_class="hidden-480" w_tip="true" >文件类型</th>
			        <th w_index="validCreateDt" w_class="hidden-480" width="130px">创建时间</th>
		            <th w_render="validClassFunc" w_class="hidden-480" class="cdata" w_index="validClass" width="120px">有效区分</th>
			        <th w_render="removeClassFunc" w_class="hidden-480" class="cdata" w_index="deleteClass" width="120px">删除区分</th>
			        <th w_render="operateFunc" class="nodata width-480-ctr" w_index="id" w="150px" width="100px">操作</th>
	<%};%> 
<% var layoutParas =
{"title":"",table:"searchTable",tableClass:"","ths":ths,"toolbar":toolbar,"form":form,"pageLevelJS":pageLevelJS};
layout("/WEB-INF/views/btl/template/backBasicGridTemplate.html", layoutParas){ %>
<!--  -->
<div id="add-dialog" class="hide">
   <div class="col-xs-12"  style="margin-top: 5px;margin-bottom: 5px">
  		 <form action="" class="form-horizontal editForm" role="form">
  		  <div class="alert alert-danger hide alert-dismissable" role="alert">
			<button type="button" class="close" data-dismiss="alert" aria-hidden="true">
				<i class="ace-icon fa fa-times"></i>
			</button>
			<strong>
			<i class="ace-icon fa fa-times"></i><span class="editForm-msg-head"></span></strong>
			<span class="editForm-msg"></span>
			<br />
		</div>
		<input type="hidden" name="id">
		<input type="hidden" name="pId" value="${data.id}">
	    <input type="hidden" name="parents" value="${data.parents}/${data.name}">
		<input type="hidden" name="isParent" value="1">
  		<div class="col-xs-12">
  		   <label class="" for="name">上级文件路径：</label><span name="pParents">${data.parents}/${data.name}</span>
  		</div>
  		 <div class="col-xs-12">
	  		   <div class="form-group  col-md-12">
				       <label for="name" class="col-sm-3 control-label no-padding-right">上级目录:</label>
				       <div class="col-sm-9 inline-height ">
							  <input type="text" value="" class="disabled col-xs-10" disabled="disabled"  placeholder="" />
				 	    </div> 
				 </div>
			      <div class="form-group  col-md-12">
				       <label for="name" class="required-before col-sm-3 control-label no-padding-right">文件名:</label>
				       <div class="col-sm-9 inline-height ">
							  <input type="text" oldval="" class="validate[required,maxSize[50]] col-xs-10" name="name" placeholder="文件名" />
				 	    </div> 
				   </div>
				  <%if(has(sysFlags) && sysFlags.~size>1){ %>
				 	 <%if(has(para) && !isEmpty(para.instanceId)){ %>
				        <input type="hidden"  name="instanceId" value="${para.instanceId}">
					   <% }else{ %>
					     <div class="form-group col-md-12">
						     <label class="required-before col-sm-3 control-label no-padding-right" for="instanceId">所属系统:</label>
							 <div class="col-sm-9 inline-height ">
							   <select placeholder="所属系统" name="instanceId" class="col-xs-10">
									<% for(res in sysFlags!){ %>
									  <option value="${res.id}">${res.nameStr}</option>
								　　   <% } %>
								</select>
						  	 </div>
						  </div>
					   <% } %>
				  <%}else{%>
				       <input type="hidden"  name="instanceId" value="${sys_flag}">
				    <% } %>
				  <div class="form-group col-md-12">
				     <label for="remark" class="col-sm-3 control-label no-padding-right">备注:</label>
				     <div class="col-sm-9 inline-height">
					    <input type="text"  value="" oldval="" class="validate[maxSize[50]] col-xs-10" name="remark" placeholder="备注">
					  </div>
				  </div>	  
	  		 </div>
		  </form>
  	 </div>
</div><!-- #dialog-message -->
	
<%} %>
